﻿using System.ComponentModel;
using System.Web.Services;
using SVTTranslateTextEngine.Properties;
using SVTTranslateTextEngine.TTChecker;
using SVTTranslateTextEngine.TTInputParmas;
using SVTTranslateTextEngine.TTResults;

namespace SVTTranslateTextEngine
{
    /// <summary>
    /// Summary description for TTWebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class TTWebService : WebService
    {
        //Web methods to request system configurable parameters

        /// <summary>
        /// that are implemented for translation. E.g. “GOOGLE”, “BING”, etc. (“GOOGLE” is what we will develop first)
        /// </summary>
        /// <returns>Return a string array of vendor names</returns>
        [WebMethod]
        public string[] GetSupportedTranslateVendors()
        {
            return new []{"GOOGLE"};
        }

        /// <summary>
        /// If source text length less than maximum lenght, that can be translated using the web method TranslateTextToText(…)
        /// </summary>
        /// <returns>Return the maximum length allowed of source text</returns>
        [WebMethod]
        public long GetMaxSizeTextToText()
        {
            return Settings.Default.TextToTextMaxLength;
        }

        /// <summary>
        /// The web service will be configured to allow/disallow translating text to a file
        /// </summary>
        /// <returns>Return Y or N if it supports translating text to a file</returns>
        [WebMethod]
        public string GetIsTranslateTextToFile()
        {
            return Settings.Default.TranslateTextToFile;
        }

        /// <summary>
        /// Configured the lanaguage is support.
        /// </summary>
        /// <param name="szVendorName">Translate engine's vendor name</param>
        /// <param name="szLang">language code </param>
        /// <returns>Return Y or N if szLang is a valid language supported</returns>
        [WebMethod]
        public bool GetIsValidLanguage(string szVendorName, string szLang)
        {
            return LanguageChecker.CheckIsSupported(szVendorName,szLang);
        }

        /// <summary>
        /// Confirm how many translates engine's vendor names can support the source language 
        /// </summary>
        /// <param name="szLang">language code </param>
        /// <returns>Return a string array of vendor names. E.g. “GOOGLE”, “BING”, etc.</returns>
        [WebMethod]
        public string[] GetSupportedTranslateLanguageVendors(string szLang)
        {
            return null;
        }

        /// <summary>
        /// Soap object contain the source text which will translate by the web mothed 
        /// </summary>
        /// <param name="textInput"></param>
        /// <returns>Return the translate text as string</returns>
        [WebMethod]
        public ToTextResult TranslateTextToText(TextInputParma textInput)
        {
            return null;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="textInput"></param>
        /// <returns></returns>
        [WebMethod]
        public ToFileResult TranslateTextToFile(TextInputParma textInput)
        {
            return null;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="fileInput"></param>
        /// <returns></returns>
        [WebMethod]
        public ToFileResult TranslateFileToFile(FileInputParma fileInput)
        {
            return null;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="textInput"></param>
        /// <param name="execDbInput"></param>
        /// <returns></returns>
        [WebMethod]
        public UpdateDBResult TranslateTextToDB(TextInputParma textInput, ExecDBInputParma execDbInput)
        {
            return null;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="fileInput"></param>
        /// <param name="execDbInput"></param>
        /// <returns></returns>
        [WebMethod]
        public UpdateDBResult TranslateFileToDB(FileInputParma fileInput, ExecDBInputParma execDbInput)
        {
            return null;
        }
    }
}